
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>管理员列表</title>

    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/main.css" media="all">
    <script src="${pageContext.request.contextPath}/lib/layui/layui.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/x-layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">

    <script>
        layui.use(['laydate','element','laypage','layer'], function(){});
    </script>

</head>
<body>

<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>管理员管理</cite></a>
              <a><cite>管理员列表</cite></a>
            </span>

    <button class="layui-btn x-right" style="margin-left: 10px;"
            onclick="javascript:location.replace(location.href);">
        <i class="layui-icon">ဂ</i>&nbsp;&nbsp;刷新
    </button>
    <button class="layui-btn x-right "
            onclick="add('添加管理员 ','${pageContext.request.contextPath}/admin/addUi','600','500')">
        <i class="layui-icon">&#xe608;</i>&nbsp;&nbsp;添加
    </button>
</div>

<div class="x-body">
    <table class="layui-table">
        <thead>
        <tr>
            <th>序号</th>
            <th>管理员编号</th>
            <th>用户名</th>
            <th>密码</th>
            <th>角色</th>
            <th>头像</th>
            <th>注册时间</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${pageInfo.list}" var="admin" varStatus="state">
            <tr>
                <td>${state.index+1}</td>
                <td>${admin.id}</td>
                <td>${admin.username}</td>
                <td>${admin.password}</td>
                <td>${admin.rname}</td>
                <td>
                    <img src="${pageContext.request.contextPath}/images/${admin.header}" width="40px">
                </td>
                <td>1970-01-01 08:00:00</td>
                <td>
                    <c:if test="${admin.state==1}" >可用</c:if>
                    <c:if test="${admin.state==0}" >禁用</c:if>
                </td>
                <td class="td-manage">
                    <a title="编辑" href="javascript:;"
                       onclick="edit('编辑管理员','${pageContext.request.contextPath}/admin/editUi','${admin.id}','','510')"
                       class="ml-5" style="text-decoration:none">
                        <i class="layui-icon">&#xe642;</i>
                    </a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div id="page">
        <ul class="pagination">
            <ul class="pagination">
                <li <c:if test="${pageInfo.pageNum == 1}">class="disabled"</c:if>>
                    <a href="${pageContext.request.contextPath}/admin/listUi?pageNum=1">&laquo;</a>
                </li>
                <li <c:if test="${pageInfo.pageNum == 1}">class="disabled"</c:if>>
                    <a href="${pageContext.request.contextPath}/admin/listUi?pageNum=${pageInfo.pageNum-1}">&lt;</a>
                </li>
                <c:forEach begin="1" end="${pageInfo.pages}" var="index">
                    <li <c:if test="${index == pageInfo.pageNum}">class="active"</c:if>>
                        <a href="${pageContext.request.contextPath}/admin/listUi?pageNum=${index}">${index}</a>
                    </li>
                </c:forEach>
                <li <c:if test="${pageInfo.pageNum == pageInfo.pages}">class="disabled"</c:if>>
                    <a href="${pageContext.request.contextPath}/admin/listUi?pageNum=${pageInfo.pageNum+1}">&gt;</a>
                </li>

                <li <c:if test="${pageInfo.pageNum == pageInfo.pages}">class="disabled"</c:if>>
                    <a href="${pageContext.request.contextPath}/admin/listUi?pageNum=${pageInfo.pages}">&raquo;</a>
                </li>
            </ul>
        </ul>
    </div>

</div>


<script>


    /*添加*/
    function add(title,url,w,h){
        x_admin_show(title,url,w,h);
    }

    //编辑
    function edit (title,url,id,w,h) {
        url = url+"?id="+id;
        x_admin_show(title,url,w,h);
    }

</script>

</body>
</html>